package com.wn.icloud.provider.demo.controller;

import com.wn.icloud.provider.demo.entity.Demo;
import com.wn.icloud.provider.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * (Demo)表控制层
 *
 * @author makejava
 * @since 2020-04-24 19:26:41
 */
@RestController
@RequestMapping("/test/demo")
public class DemoController {

    /**
     * 服务对象
     */
    @Autowired
    private DemoService demoService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Demo selectOne(Integer id) {
        return this.demoService.queryById(id);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param demo 主键
     * @return 是否成功
     */
    @PostMapping("insert")
    public Object insert(@RequestBody Demo demo) {
        return this.demoService.insert(demo);
    }

    public static void main(String[] args) {
        System.out.println("111");
    }
}